<script lang="ts" setup>
import { ref } from 'vue'
import {
  User,
  Service,
  Expand,
  ChatDotSquare,
  Fold,
  Aim,
  Edit,
  School,
  Files,
  DocumentChecked,
  Microphone
} from '@element-plus/icons-vue'
import studentPageJumper from '../utils/router/StudentPageJumper'

const isCollapse = ref(false)
const handleOpen = (key: string, keyPath: string[]) => {
  //console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  //console.log(key, keyPath)
}
const collapseChange = ()=>{
  isCollapse.value = !isCollapse.value
}
</script>

<template>
  <div class="main-container">
    <el-menu
        default-active="1-1"
        class="el-menu-vertical-demo"
        :collapse="isCollapse"
        @open="handleOpen"
        @close="handleClose"
    >
      <el-menu-item @click="collapseChange">
        <el-icon v-if="isCollapse"><Expand /></el-icon>
        <el-icon v-else><Fold /></el-icon>
        <span>收起</span>
      </el-menu-item>

      <el-sub-menu index="1">
        <template #title>
          <el-icon><Edit /></el-icon>
          <span>习题任务</span>
        </template>
        <el-menu-item index="1-1" @click="studentPageJumper.jumpToClassTask()">
          <el-icon><School /></el-icon>
          <span>班级任务</span>
        </el-menu-item>
        <el-menu-item index="1-2" @click="studentPageJumper.jumpToOnlineTask()">
          <el-icon><Files /></el-icon>
          <span>线上题库</span>
        </el-menu-item>
      </el-sub-menu>

      <el-sub-menu index="2">
        <template #title>
          <el-icon><DocumentChecked /></el-icon>
          <span>智能批改</span>
        </template>
        <el-menu-item index="2-1" @click="studentPageJumper.jumpToClassCorrect()">
          <el-icon><School /></el-icon>
          <span>班级任务</span>
        </el-menu-item>
        <el-menu-item index="2-2" @click="studentPageJumper.jumpToOnlineCorrect()">
          <el-icon><Files /></el-icon>
          <span>线上练习</span>
        </el-menu-item>
      </el-sub-menu>

      <el-menu-item index="3" @click="studentPageJumper.jumpToStudentAnalysis()">
        <el-icon><Aim /></el-icon>
        <span>AI学情分析</span>
      </el-menu-item>

      <el-sub-menu index="4">
        <template #title>
          <el-icon><Microphone /></el-icon>
          <span>AI听力口语</span>
        </template>
        <el-menu-item index="4-1" @click="studentPageJumper.jumpToListeningExercise()">
          <el-icon><Service /></el-icon>
          <span>智能听力问答</span>
        </el-menu-item>
        <el-menu-item index="4-2" @click="studentPageJumper.jumpToOralPractice()">
          <el-icon><ChatDotSquare /></el-icon>
          <span>AI口语对练</span>
        </el-menu-item>
      </el-sub-menu>

      <el-menu-item index="5" @click="studentPageJumper.jumpToUserCenter()">
        <el-icon><User /></el-icon>
        <span>学生用户中心</span>
      </el-menu-item>
    </el-menu>
    <router-view class="children-router-view"/>
  </div>
</template>

<style scoped>
  .main-container{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  ::v-deep .el-menu{
    background-color: #f8f9fc;
    height: 100%;
  }
  .children-router-view{
    flex: 1;
    height: 100%;
  }
</style>